<?php
namespace Products\Model;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;
use Zend\Paginator\Paginator;
use Zend\Db\Sql\Predicate;
use Zend\Db\Sql\Expression;

class OffersTable
{
    protected $tableGateway;
	protected $select;
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
		$this->select = new Select();
    }
	public function addoffer($offers,$product_id)
    {		
		$data = array(
			'product_id' 	     => $product_id,
			'offer_content'      => $offers['ocontent'],
			'offer_for_quantity' => $offers['oquantity'], 	
			'offer_price' 	     => $offers['oprice'], 	
			'offer_status' 	     => 0,			
			'added_date' 	     => date('Y-m-d H:i:s'),	
			'expire_date_from' 	 => $offers['edfrom'],	
			'expire_date_to' 	 => $offers['edto'],	
			'modified_date' 	 => date('Y-m-d H:i:s'),	
		);
		$this->tableGateway->insert($data);		
		return $this->tableGateway->lastInsertValue;
    }
	public function getallCategories(){
		$select = $this->tableGateway->getSql()->select();		
		$resultSet = $this->tableGateway->selectWith($select);
		return $resultSet;	        
	} 	
}